﻿using MagicT_API.Responsitory;
using MagicVilla_API.Data;
using MagicVilla_API.Models;
using MagicVilla_API.Responsitory.IReponsitory;


namespace MagicVilla_API.Responsitory
{
    public class VillaResponsitory : Responsitory<Villa>, IVillaResponsitory
    {
        private readonly ApplicationDbContext _db;

        public VillaResponsitory(ApplicationDbContext db):base(db)
        {
            _db = db;
        }


        public async Task<Villa> Update(Villa entity)
        {
            entity.UpdatedDate = DateTime.Now;
            _db.Villas.Update(entity);
            await _db.SaveChangesAsync();
            return entity;
        }
    }
}
